import React from 'react';

class App extends React.Component {
    // constructor(props) {
    //     super(props);
    // }
    setRandomText () {
        let text = parseInt(Math.random() * 1000 * 1000 * 1000)
        this.props.setRandomText(text) // 状态提升
    }
    render () {
        const { randomText } = this.props
        return (
            <div className="test-one-box rowsc">
                <div>{randomText}</div>
                <div onClick={() => this.setRandomText()}>随机数</div>
            </div>
        )
    }
}

export default App